﻿
/*----------------------------------------------------------------//
// 文件名：MoEquip.cs
// 文件功能描述：实体 MoEquip.
// 
// 创建标识：Template  ver 5.0.20090429 2009-11-20
//
// 修改标识：
// 修改描述：
//----------------------------------------------------------------*/
#region MoEquip
using System;
using System.Data;
namespace EQT.Model
{
    /// <summary>
    /// 业务实体MoEquip
    /// </summary>
    public partial class MoEquip : ICloneable
    {
        #region 表Equip的字段
        private string equipId;
        private string equipName;
        private string oem;
        private DateTime exFactDate;
        private string nameplate;
        private DateTime buyDate;
        private decimal usefulLife;
        private int maintainDayCyc;
        private string equipConfigs;
        #endregion

        #region 构造函数
        public MoEquip()
        {
            exFactDate = new DateTime(1900, 1, 1); buyDate = new DateTime(1900, 1, 1);

        }
        #endregion

        #region 拷贝构造函数

        public MoEquip(MoEquip item)
        {
            item.CopyTo(this);
        }
        #endregion

        #region 带参数构造函数
        public MoEquip(string equipId, string equipName, string oem, DateTime exFactDate, string nameplate, DateTime buyDate, decimal usefulLife, int maintainDayCyc, string equipConfigs)
        {
            this.equipId = equipId;
            this.equipName = equipName;
            this.oem = oem;
            this.exFactDate = exFactDate;
            this.nameplate = nameplate;
            this.buyDate = buyDate;
            this.usefulLife = usefulLife;
            this.maintainDayCyc = maintainDayCyc;
            this.equipConfigs = equipConfigs;
        }
        #endregion

        #region 表Equip的字段属性
        /// <summary>
        /// EQUIP_ID
        /// </summary>
        public string EquipId
        {
            get { return equipId; }
            set { equipId = value; }
        }
        /// <summary>
        /// EQUIP_NAME
        /// </summary>
        public string EquipName
        {
            get { return equipName; }
            set { equipName = value; }
        }
        /// <summary>
        /// OEM
        /// </summary>
        public string Oem
        {
            get { return oem; }
            set { oem = value; }
        }
        /// <summary>
        /// EX_FACT_DATE
        /// </summary>
        public DateTime ExFactDate
        {
            get { return exFactDate; }
            set { exFactDate = value; }
        }
        /// <summary>
        ///使用URL，引用外部文件。例如：   /EQTWEBAPP/NAMEPLACE/EQUIP0003.JPG
        /// </summary>
        public string Nameplate
        {
            get { return nameplate; }
            set { nameplate = value; }
        }
        /// <summary>
        /// BUY_DATE
        /// </summary>
        public DateTime BuyDate
        {
            get { return buyDate; }
            set { buyDate = value; }
        }
        /// <summary>
        /// USEFUL_LIFE
        /// </summary>
        public decimal UsefulLife
        {
            get { return usefulLife; }
            set { usefulLife = value; }
        }
        /// <summary>
        /// MAINTAIN_DAY_CYC
        /// </summary>
        public int MaintainDayCyc
        {
            get { return maintainDayCyc; }
            set { maintainDayCyc = value; }
        }
        /// <summary>
        /// EQUIP_CONFIGS
        /// </summary>
        public string EquipConfigs
        {
            get { return equipConfigs; }
            set { equipConfigs = value; }
        }
        #endregion

        #region 辅助函数
        /// <summary>
        /// 拷贝函数
        /// </summary>
        public MoEquip CopyTo(MoEquip item)
        {
            item.equipId = this.equipId;
            item.equipName = this.equipName;
            item.oem = this.oem;
            item.exFactDate = this.exFactDate;
            item.nameplate = this.nameplate;
            item.buyDate = this.buyDate;
            item.usefulLife = this.usefulLife;
            item.maintainDayCyc = this.maintainDayCyc;
            item.equipConfigs = this.equipConfigs;
            return item;
        }
        /// <summary>
        /// 克隆函数
        /// </summary>		
        public object Clone()
        {
            MoEquip mo = new MoEquip();
            mo.EquipId = this.EquipId;
            mo.EquipName = this.EquipName;
            mo.Oem = this.Oem;
            mo.ExFactDate = this.ExFactDate;
            mo.Nameplate = this.Nameplate;
            mo.BuyDate = this.BuyDate;
            mo.UsefulLife = this.UsefulLife;
            mo.MaintainDayCyc = this.MaintainDayCyc;
            mo.EquipConfigs = this.EquipConfigs;
            return mo;
        }
        ///<summary>
        ///判断对象是否相等
        ///<summary>
        public override bool Equals(object obj)
        {
            if (object.ReferenceEquals(this, obj))
            {
                return true;
            }
            else
            {
                MoEquip NewEquip = obj as MoEquip;
                if (NewEquip == null)
                {
                    return false;
                }
                else
                {
                    if (NewEquip.EquipId == this.EquipId && NewEquip.EquipName == this.EquipName && NewEquip.Oem == this.Oem && NewEquip.ExFactDate == this.ExFactDate && NewEquip.Nameplate == this.Nameplate && NewEquip.BuyDate == this.BuyDate && NewEquip.UsefulLife == this.UsefulLife && NewEquip.MaintainDayCyc == this.MaintainDayCyc && NewEquip.EquipConfigs == this.EquipConfigs)
                    {
                        return true;
                    }
                }

            }
            return false;

        }
        ///TODO:you should modify GetHashCode by yourself.
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public override string ToString()
        {
            return String.Format(System.Globalization.CultureInfo.InvariantCulture, "EquipId={0}/EquipName={1}/Oem={2}/ExFactDate={3}/Nameplate={4}/BuyDate={5}/UsefulLife={6}/MaintainDayCyc={7}/EquipConfigs={8}", equipId, equipName, oem, exFactDate, nameplate, buyDate, usefulLife, maintainDayCyc, equipConfigs);

        }
        #endregion


        #region DataTable Help Function
        ///<summary>
        ///DataRow转换成Model
        ///</summary>
        public void Row2Model(DataRow row)
        {
            if (row["Equip_ID"] != null && row["Equip_ID"] != DBNull.Value)
            {
                this.EquipId = (string)row["Equip_ID"];
            }
            else
            {
                this.EquipId = string.Empty;
            }
            if (row["Equip_Name"] != null && row["Equip_Name"] != DBNull.Value)
            {
                this.EquipName = (string)row["Equip_Name"];
            }
            else
            {
                this.EquipName = string.Empty;
            }
            if (row["OEM"] != null && row["OEM"] != DBNull.Value)
            {
                this.Oem = (string)row["OEM"];
            }
            else
            {
                this.Oem = string.Empty;
            }
            if (row["Ex_Fact_Date"] != null && row["Ex_Fact_Date"] != DBNull.Value)
            {
                this.ExFactDate = (DateTime)row["Ex_Fact_Date"];
            }
            else
            {
                this.ExFactDate = DateTime.MinValue;
            }
            if (row["Nameplate"] != null && row["Nameplate"] != DBNull.Value)
            {
                this.Nameplate = (string)row["Nameplate"];
            }
            else
            {
                this.Nameplate = string.Empty;
            }
            if (row["Buy_Date"] != null && row["Buy_Date"] != DBNull.Value)
            {
                this.BuyDate = (DateTime)row["Buy_Date"];
            }
            else
            {
                this.BuyDate = DateTime.MinValue;
            }
            if (row["Useful_Life"] != null && row["Useful_Life"] != DBNull.Value)
            {
                this.UsefulLife = (decimal)row["Useful_Life"];
            }
            else
            {
                this.UsefulLife = 0;
            }
            if (row["Maintain_Day_Cyc"] != null && row["Maintain_Day_Cyc"] != DBNull.Value)
            {
                this.MaintainDayCyc = (int)row["Maintain_Day_Cyc"];
            }
            else
            {
                this.MaintainDayCyc = 0;
            }
            if (row["Equip_Configs"] != null && row["Equip_Configs"] != DBNull.Value)
            {
                this.EquipConfigs = (string)row["Equip_Configs"];
            }
            else
            {
                this.EquipConfigs = string.Empty;
            }
        }

        ///<summary>
        ///Model转换成DataRow
        ///</summary>
        public void Model2Row(DataRow row)
        {
            row["Equip_ID"] = this.EquipId;
            row["Equip_Name"] = this.EquipName;
            row["OEM"] = this.Oem;
            row["Ex_Fact_Date"] = this.ExFactDate;
            row["Nameplate"] = this.Nameplate;
            row["Buy_Date"] = this.BuyDate;
            row["Useful_Life"] = this.UsefulLife;
            row["Maintain_Day_Cyc"] = this.MaintainDayCyc;
            row["Equip_Configs"] = this.EquipConfigs;
        }
        #endregion
    }
}
#endregion
